﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EasySL.Data.Interface;
using EasySL.Entity;
using System.Threading;

namespace EasySL.Data
{
    public class ImplDAL : IDAL
    {
        #region IDAL Members

        public bool UserLogin(string userName, string password)
        {
            Thread.Sleep(1000);
            return userName == "admin" && password == "admin";
        }

        public List<Category> GetCategoryList()
        {
            List<Category> categoryList = new List<Category>();
            for (int i = 1; i <= 10; i++)
            {
                categoryList.Add(new Category()
                {
                    Id = i,
                    CategoryName = "Category" + i.ToString()
                });
            };
            return categoryList;
        }

        public List<Product> GetAllProductList()
        {          
            List<Product> products = new List<Product>();

            Random rd = new Random();

            for (int i = 500; i > 0; i--)
            {
                products.Add(new Product()
                {
                    Id = i,
                    Name = "product'" + i.ToString(),
                    Price = rd.Next(1000, 2000),
                    Info = Guid.NewGuid().ToString(),
                    Category = new Category()
                    {
                        Id = 1,
                        CategoryName = "Category" + rd.Next(1, 10).ToString()
                    }
                });
            };

            return products;
        }

        #endregion

    }
}
